; ModuleID = 'branch'
source_filename = "branch_example"

define i32 @select_value(i32 %x) {
entry:
  %cond = icmp sgt i32 %x, 0
  br i1 %cond, label %then, label %else

then:
  ; 当 %x > 0 时，返回 %x * 2
  %acc = add i32 %x, 1
  br label %result

else:
  ; 否则返回常量 -1
  br label %result

result:
  %value = phi i32 [ %acc, %then ], [ 0, %else ]
  ret i32 %value
}
